###  Analysis of Timing

time.dat <- rbind(data.trump, data.asym.large, data.asym.small, data.sym.large, data.sym.small)
head(time.dat)

### Experiments
time.median <- aggregate(time.dat$time[time.dat$experiment!="Trump"], by=list(treatment=time.dat$treatment[time.dat$experiment!="Trump"]), median, na.rm=T)
time.median
xtable(time.median)

m <- lm(time ~ treatment, data=time.dat[time.dat$experiment!="Trump",])
summary(m)
anova(m)
anova(m)$"F value"[1]
anova(m)$"Pr(>F)"[1]

new.table <- data.frame(matrix(NA,7,3))
new.table[1:5,] <-time.median
new.table[1:5,1] <- as.character(time.median[1:5,1])
new.table[6:7,1] <- c("F-value", "Pr(>F)")
new.table[6:7,2] <- c(anova(m)$"F value"[1], anova(m)$"Pr(>F)"[1])



### Trump Vote 2020
time.median <- aggregate(time.dat$time[time.dat$experiment=="Trump"], by=list(treatment=time.dat$treatment[time.dat$experiment=="Trump"]), median, na.rm=T)
time.median
xtable(time.median)

m <- lm(time ~ treatment, data=time.dat[time.dat$experiment=="Trump",])
summary(m)
anova(m)
xtable(anova(m))


new.table1 <- data.frame(matrix(NA,7,2))
new.table1[1:5,] <-time.median
new.table1[1:5,1] <- as.character(time.median[1:5,1])
new.table1[6:7,1] <- c("F-value", "Pr(>F)")
new.table1[6:7,2] <- c(anova(m)$"F value"[1], anova(m)$"Pr(>F)"[1])


new.table[,3] <- new.table1[,2]




print(xtable(new.table, caption=text), floating = FALSE,booktabs = T, include.rownames=FALSE,
      file="out/fig/Tab_A11.tex",sep="")



